/* C.Strnlcmp: compare two strings for n bytes, treating all letters as
 * lower case
 */

#include <ctype.h>
#include "utils.h"

int strnlcmp (const char *s, const char *t, int n)
{
        while ( --n >= 0 )
        {
                if ( *s == '\0' || *t == '\0' || tolower(*s) != tolower(*t) )
                        return (tolower(*s) - tolower(*t));
                ++s;
                ++t;
        }

        return (0);
}
